package com.qfhd.soft.cjzcore.Model;

import com.qfhd.soft.cjzcore.Core.CJJsonUtils;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.List;

public class Task_try_detail_model {
//    "apk_icon": "https://pp.myapp.com/ma_icon/0/icon_52743857_1584568816/96",
//            "file_size": 422538350,
//            "apk_name": "忍者必须死3",
//            "apk_url": "http://uri6.com/tkio/iaUrAza",
//            "id": 1,
//            "full_reward": "0.55",
//            "start_time": 28800,
//            "end_time": 86340,
//            "total_num": 300,
//            "cost_num": 1,
//            "package_name": "com.pandadastudio.ninjamustdie",
//            "apk_version_code": "1097",
//            "apk_version": "1.0.97",
//            "task_title": "忍者必须死3",
//            "operate_note": "忍者必须死3：打开【忍者必须死3】，使用手机号登录，完成新手教学闯关"
    public String apk_icon;
    public long file_size;
    public String apk_name;
    public String apk_url;
    public int id;
    public String tid;
    public String full_reward;
    public long apply_at;//抢任务时间
    public String start_time;
    public String end_time;
    public String total_num;
    public String cost_num; //已经完成的数据，整个试玩任务而言
    public String package_name;
    public String apk_version_code;
    public String apk_version;
    public String task_title;
    public String operate_note;
    public List<Task_try_detail_section_model> sections;

    public static Task_try_detail_model getModelByJSONObject(JSONObject object){
        Task_try_detail_model model = new Task_try_detail_model();

        JSONObject tmp = CJJsonUtils.getJSONObjectFromKey_string(object,"main_info");

        model.apk_icon = CJJsonUtils.getValueFromKey_string(tmp,"apk_icon");
        model.apk_name = CJJsonUtils.getValueFromKey_string(tmp,"apk_name");
        model.apk_url = CJJsonUtils.getValueFromKey_string(tmp,"apk_url");
        model.apk_version = CJJsonUtils.getValueFromKey_string(tmp,"apk_version");
        model.apk_version_code = CJJsonUtils.getValueFromKey_string(tmp,"apk_version_code");
        model.apply_at = CJJsonUtils.getValueFromKey_long(tmp,"apply_at");
        model.cost_num = CJJsonUtils.getValueFromKey_string(tmp,"cost_num");
        model.end_time = CJJsonUtils.getValueFromKey_string(tmp,"end_time");
        model.file_size = CJJsonUtils.getValueFromKey_long(tmp,"file_size");
        model.full_reward = CJJsonUtils.getValueFromKey_string(tmp,"full_reward");
        model.id = CJJsonUtils.getValueFromKey_int(tmp,"id");
        model.operate_note = CJJsonUtils.getValueFromKey_string(tmp,"operate_note");
        model.package_name = CJJsonUtils.getValueFromKey_string(tmp,"package_name");
        model.task_title = CJJsonUtils.getValueFromKey_string(tmp,"task_title");
        model.total_num = CJJsonUtils.getValueFromKey_string(tmp,"total_num");
        model.tid = CJJsonUtils.getValueFromKey_string(tmp,"tid");
        model.start_time = CJJsonUtils.getValueFromKey_string(tmp,"start_time");

        model.sections = Task_try_detail_section_model.getListByJSONObject(CJJsonUtils.getJSONArrayFromKey(object,"sections"));

        return model;
    }

}
